package com.ssy.lingxi.pay.common;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 授信交易状态枚举
 * @author 伍将
 * @date 2020/8/25
 * @version 2.0.0
 */
public enum CreditTradeStatusEnum {


    /**
     * 所有
     */
    ALL(0, "所有"),
    /**
     * 待确认还款结果
     */
    WAIT_CONFIRM(1, "待确认还款结果"),
    /**
     * 确认未到账
     */
    CONFIRM_NOT_RECEIPT(2, "确认未到账"),
    /**
     * 确认到账
     */
    CONFIRM_RECEIPT(3, "确认到账");

    private final Integer code;

    CreditTradeStatusEnum(Integer code, String message) {
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(),this.code);
    }

    public static String getItemMessage(Integer code) {
        return Arrays.stream(CreditTradeStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
}
